/**
 * 
 */
package org.cuny.util;

/**
 * @author di.wd
 *
 */
public class DataUtil
{
	/**
	 * @param fileName
	 * @param delim
	 * @return
	 */
	public final static String[][] parseData( String fileName, String delim )
	{
		String[] lineDatas = FileUtil.readFileByLines( fileName );
		
		int length = lineDatas.length;
		String[][] datas = new String[ length ][];
		for ( int i = 0; i < length; i++  )
		{
			datas[ i ] = StringUtil.separateString( lineDatas[ i ], delim );
		}
		
		return datas;
	}
	
	/**
	 * @param args
	 */
	public static void main( String[] args )
	{
		String[][] datas = DataUtil.parseData( "D:\\help\\Personal\\cost1.txt", " " );
		int iLength = datas.length;
		for ( int i = 0; i < iLength; i++ )
		{
			int jLength = datas[ i ].length;
			for ( int j = 0; j < jLength; j++ )
			{
				System.out.print( datas[ i ][ j ] + " " );
			}
			System.out.println();
		}
	}
}
